import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";


// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: process.env.NODE_ENV === "production" ? "/for4-vision-project" : "/",
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  build: {
    outDir: "dist",
    assetsDir: "assets",
    sourcemap: false,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["vue", "vue-router"],
        },
      },
    },
  },
  // 开发服务器配置
  server: {
    port: 3000,
    open: true,
    host: true,
  },
  // 预览服务器配置
  preview: {
    port: 4173,
    open: true,
    host: true,
  },
});
